char * str_utf8_to_cp1252( const char * str );
char * str_utf8_to_ascii( const char * str );
+char * rot13( const char *str );
+
/*
* PalmOS records like fixed-point numbers, which should be rounded
* to deal with possible floating-point representation errors.
static void *mkshort_handle;
static char *stylesheet = NULL;
+static char *encrypt = NULL;
#define MYNAME "HTML"
arglist_t html_args[] = {
{ "stylesheet", &stylesheet,
"Path to HTML style sheet", ARGTYPE_STRING },
+ { "encrypt", &encrypt,
+ "Encrypt hints using ROT13", ARGTYPE_BOOL },
{0, 0, 0, 0}
};
fprintf (file_out, "<p class=\"desclong\">%s</p>\n", strip_nastyhtml(wpt->gc_data.desc_long.utfstring));
}
if (wpt->gc_data.hint) {
- fprintf (file_out, "<p class=\"hint\"><strong>Hint:</strong> %s</p>\n", wpt->gc_data.hint);
+ char *hint = NULL;
+ if ( encrypt )
+ hint = rot13( wpt->gc_data.hint );
+ else
+ hint = xstrdup( wpt->gc_data.hint );
+ fprintf (file_out, "<p class=\"hint\"><strong>Hint:</strong> %s</p>\n", hint);
+ xfree( hint );
}
}
else if (strcmp(wpt->notes,wpt->description)) {
static void *mkshort_handle;
static char *suppresssep = NULL;
+static char *encrypt = NULL;
#define MYNAME "TEXT"
arglist_t text_args[] = {
{ "nosep", &suppresssep,
"Suppress separator lines between waypoints", ARGTYPE_BOOL },
+ { "encrypt", &encrypt,
+ "Encrypt hints using ROT13", ARGTYPE_BOOL },
{0, 0, 0, 0}
};
xfree(stripped_html);
}
if (wpt->gc_data.hint) {
- fprintf (file_out, "\nHint: %s\n", wpt->gc_data.hint);
+ char *hint = NULL;
+ if ( encrypt )
+ hint = rot13( wpt->gc_data.hint );
+ else
+ hint = xstrdup( wpt->gc_data.hint );
+ fprintf (file_out, "\nHint: %s\n", hint);
+ xfree( hint );
}
}
else if (strcmp(wpt->notes,wpt->description)) {
strcat(d, p + slen);
return d;
}
-
+
+char *
+rot13( const char *s )
+{
+ char *result = xstrdup( s );
+ char *cur = result;
+ int flip = 1;
+ while (cur && *cur ) {
+ if ( flip ) {
+ if (*cur == '[') flip = 0;
+ else if ( *cur >= 'A' && *cur <= 'Z' ) {
+ *cur = 'A' + ((*cur-'A')+13)%26;
+ }
+ else if ( *cur >= 'a' && *cur <= 'z' ) {
+ *cur = 'a' + ((*cur-'a')+13)%26;
+ }
+ }
+ else if ( *cur == ']' ) flip = 1;
+ cur++;
+ }
+ return result;
+}
+
void utf8_to_int( const char *cp, int *bytes, int *value )
{
if ( (*cp & 0xe0) == 0xc0 ) {